package main

import "fmt"

//#link: https://leetcode-cn.com/problems/student-attendance-record-i/
func main() {
	s := "PPALLL"
	fmt.Println(checkRecord(s))
}

func checkRecord(s string) bool {
	//1.s中的A只能有1天 即A<1
	sByte := []byte(s)
	aCount := 0
	lCount := 0
	//2.不会有三个连续的L
	for _, c := range sByte {
		if aCount > 1 || lCount >= 3 {
			return false
		}
		if c == 'A' {
			aCount++
		}
		if c == 'L' {
			lCount++
		} else {
			lCount = 0
		}
	}
	return !(lCount >= 3 || aCount > 1)
}
